package com.contory.ssn_lgnd.app;

import android.opengl.GLES20;

import com.contory.ssn_lgnd.framework.gl.Camera2D;
import com.contory.ssn_lgnd.framework.gl.ESShader;
import com.contory.ssn_lgnd.framework.gl.FrameBufferObject;
import com.contory.ssn_lgnd.framework.gl.SpriteBatcher;

public class EffectHelper_Blur extends EffectHelper{
	final float fbTxWidth;
	final float fbTxHeight;
	int orient = 0;
	int blurAmount = 10;
	float blurScale = 1.0f;
	float blurStrenth = 0.2f;
	
	public EffectHelper_Blur(FrameBufferObject fb, ESShader shader,
			Camera2D cam, SpriteBatcher batcher) {
		super(fb, shader, cam, batcher);
		fbTxWidth = (float)1 / fb.width;
		fbTxHeight =  (float)1 / fb.height;
	}

	@Override
	protected void bindUniforms() {
		GLES20.glUniform2f(shader.getUniform(ESShaderHandleNames.Uni_TexelSize), fbTxWidth, fbTxHeight);
		GLES20.glUniform1i(shader.getUniform(ESShaderHandleNames.Uni_Orient), orient);
		GLES20.glUniform1i(shader.getUniform(ESShaderHandleNames.Uni_BlurAmount), blurAmount);
		GLES20.glUniform1f(shader.getUniform(ESShaderHandleNames.Uni_BlurScale), blurScale);
		GLES20.glUniform1f(shader.getUniform(ESShaderHandleNames.Uni_BlurStrenth), blurStrenth);
	}
	
	public void setUniforms(int orient, int blurAmount, float blurScale, float blurStrenth){
		this.orient = orient; this.blurAmount = blurAmount; this.blurScale = blurScale; this.blurStrenth = blurStrenth;
	}
}
